﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WinRTSock.Test.Common
{
    public class ListItemViewModel : INotifyPropertyChanged
    {
        public Uri Image { get; private set; }
        public string Title { get; private set; }
        public string Subtitle { get; private set; }
        public DelegateCommand<string> ItemCommand { get; private set; }

        public static ListItemViewModel Create(Uri image, string title, string subtitle, Action<string> itemCommand)
        {
            var result = new ListItemViewModel();
            result.Image = image;
            result.Title = title;
            result.Subtitle = subtitle;
            result.ItemCommand = new DelegateCommand<string>(itemCommand);
            return result;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
